package com.skyvin.nreceipts.common.mapper;

import java.util.ArrayList;
import java.util.List;

import org.springframework.data.domain.Page;

import com.skyvin.nreceipts.common.document.ReceiptItemCategoryTemplate;
import com.skyvin.nreceipts.common.dto.ReceiptItemCategoryDTO;

public class ReceiptItemCategoryMapper {
	public static ReceiptItemCategoryDTO map(ReceiptItemCategoryTemplate receiptCategory) {
		ReceiptItemCategoryDTO receiptCategoryDTO = new ReceiptItemCategoryDTO();
		receiptCategoryDTO.setId(receiptCategory.getId());
		receiptCategoryDTO.setValue(receiptCategory.getValue());
		return receiptCategoryDTO;
	}
	
	public static List<ReceiptItemCategoryDTO> map(Page<ReceiptItemCategoryTemplate> receiptItemCategoryDocuments) {
		List<ReceiptItemCategoryDTO> receiptCategoryDTOs = new ArrayList<ReceiptItemCategoryDTO>();
		for (ReceiptItemCategoryTemplate receiptItemCategory : receiptItemCategoryDocuments) {
			receiptCategoryDTOs.add(map(receiptItemCategory));
		}
		return receiptCategoryDTOs;
	}
}
